package com.yanfan.zutai.controller.xunraostrage;

import com.yanfan.iot.domain.Device;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Component
public class XunraoFactory {

    private static final List<String> xunrao1 = new ArrayList<>();
    private static final List<String> xunrao2 = new ArrayList<>();
    private static final List<String> xunrao3 = new ArrayList<>();
    private static final List<String> xunrao4 = new ArrayList<>();
    private static final List<String> xunrao5 = new ArrayList<>();

    static {
        // B1DA71366C4C424DBE3B8929471D6B6E
        List<String> longs1 = Arrays.asList("GYBY", "GLDB1", "F14DB", "XRP2DB", "XRP1DB", "PUMPDB", "LQT4DB", "LQT3DB", "LQT2DB", "LQT1DB", "LQTZDB", "LQP2DB", "LQP1DB", "LJ2DB", "LJ1DB", "LJPUMPZDB", "GLDB2", "LDP2DB", "LDP1DB", "LQT11DB", "LQT12DB", "LQT21DB", "LQT22DB", "PUMPZDB", "ZJ2", "ZJ1", "Device1", "GL", "N4");
        xunrao1.addAll(longs1);
        // A91537A51EFA4ABA8268013005C5402B
        List<String> longs2 = Arrays.asList("KYJ1", "KYJ2", "GL12", "GL3", "AMK", "KT1", "KT2", "KT3", "KT4", "KT5", "KT6", "KT7", "MCU2", "MCU3", "KT9");
        xunrao2.addAll(longs2);
        // 06AFAEC7B3AB4DD398F09717462C41D6
        List<String> longs3 = Arrays.asList("CH1", "CH2", "AMK1", "LRY", "S7");
        xunrao3.addAll(longs3);
        // 236F6A1734AE4CDCBCA06D0D6C2AF4F2
        List<String> longs4 = Arrays.asList("D81", "D80", "D79", "D78", "D77", "D76", "D75", "D74", "D73", "D72", "D71", "D70", "D69", "D68", "D67", "D66", "D65", "D64", "D63", "D62", "D61", "D60", "D59", "D58", "D57", "D56", "D55", "D54", "D53", "D52", "D51", "D50", "D49", "D48", "D47", "D46", "D45", "D44", "D43", "D42", "D41", "D40", "D39", "D38", "D37", "D36", "D35", "D34", "D33", "D32", "D31", "D30", "D29", "D28", "D27", "D26", "D25", "D24", "D23", "D22", "D21", "D20", "D19", "D18", "D17", "D16", "D15", "D14", "D13", "D12", "D11", "D10", "D9", "D8", "D7", "D6", "D5", "D4", "D3", "D2", "D1");
        xunrao4.addAll(longs4);
        // 1B7BC3F49E3842FDB74E615612A2E3A0
        List<String> longs5 = Arrays.asList("DL", "LK", "O3");
        xunrao5.addAll(longs5);
    }

    public ConsumerXunrao getConsumer(Device device) {
        if (xunrao1.contains(device.getSerialNumber())) {
            return new ConsumerXunrao1();
        } else if (xunrao2.contains(device.getSerialNumber())) {
            return new ConsumerXunrao2();
        } else if (xunrao3.contains(device.getSerialNumber())) {
            return new ConsumerXunrao3();
        } else if (xunrao4.contains(device.getSerialNumber())) {
            return new ConsumerXunrao4();
        } else if (xunrao5.contains(device.getSerialNumber())) {
            return new ConsumerXunrao5();
        }
        return null;
    }


}
